Skip to content

chore: drop Python modules superseded by Rust (refs #59) - #62

Merged
zackees merged 1 commit into
mainfrom
chore/issue-59-remove-python-superseded-by-rust
May 13, 2026
Merged

zackees merged 1 commit into
mainfrom
chore/issue-59-remove-python-superseded-by-rust

Conversation

@zackees

@zackees zackees commented May 12, 2026 •

Copy link
Copy Markdown
Member

Summary

Aggressive Python footprint shrink. Phase 1 cleared dead Python and dep cruft. Phase 2+ moves the HTTP downloads themselves from Python into Rust so httpx and pyzstd stop being on the Python critical path.

Issue: #59 (#59 (comment))

Commits in this PR

  1. Phase A — chore: shrink Python footprint after Rust migration — removed dead modules (paths.py, filewatcher.py, its lone test) and replaced progress + rapidfuzz with stdlib.
  2. Phase A — chore(open_browser): drop redundant wait_for_server HTTP probe — Rust prints its URL once it's listening, so the follow-up httpx GET added nothing.
  3. Phase B — chore(rust): own emscripten install in the Rust CLI — new crates/fastled-cli/src/install.rs does manifest fetch + multipart download + SHA-256 verify + .tar.zst extract + .emscripten config. Wired into compile_and_serve before invoking Python; sets FASTLED_EMSCRIPTEN_DIR. Drops clang-tool-chain and pyzstd.
  4. Phase C-1 — chore(rust): own esbuild install in the Rust CLI — same shape for the esbuild npm tarball. Drops fasteners (last user removed too).

Net dep change

Python runtime: 8 → 2 deps

  • Dropped: watchdog, watchfiles, disklru, zccache, progress, rapidfuzz, clang-tool-chain, fasteners
  • Remaining: httpx, zcmds_win32 (Windows-only)

What still keeps httpx alive

  • src/fastled/project_init.py — --init flow downloads the FastLED repo zip from GitHub. Needs a Rust ensure_fastled_repo() port + Api.project_init() flow rework. Real Rust work, not a chore step.
  • src/fastled/playwright/chrome_extension_downloader.py — runtime Chrome-extension fetch for the Tauri viewer's C++ DevTools. Needs a Rust port + Tauri-side trigger.

These are tractable in follow-up PRs that each touch a distinct subsystem.

Rust additions

  • ctcb-manifest = "0.4.1" workspace dep — reuses the manifest schema from the existing clang-tool-chain-bins crate ecosystem instead of re-rolling it.
  • flate2, dirs workspace deps.

Test plan

  • bash lint clean (cargo check + ruff + pyright all green)
  • bash test — 118 passed, 1 skipped, 0 failures
  • Cold-cache emscripten install — verify on a machine without ~/.fastled/toolchains/emscripten/...
  • Cold-cache esbuild install — verify on a machine without ~/.fastled/toolchains/esbuild/...
  • CI green

Refs #59

🤖 Generated with Claude Code

Project is now Rust-first; this pass cuts the Python dep list from 8 to 4
runtime deps and drops modules whose work the Rust crates now own.

Removed modules
- src/fastled/paths.py — HERE/PROJECT_ROOT constants, zero importers.
- src/fastled/filewatcher.py — file watching is now owned by the Rust CLI.
  Comments in compile_native.py already say so. The only inbound reference
  was the unit test below.
- tests/unit/test_filechanger.py — cascading; only consumer of
  FileWatcherProcess.

Dropped dependencies (pyproject.toml)
- watchdog — only used by filewatcher.py.
- watchfiles — declared but never imported anywhere.
- disklru — never imported.
- zccache — never imported.
- progress — replaced by a stdlib itertools.cycle-based spinner.
- rapidfuzz — replaced by difflib.SequenceMatcher with a token-sort wrapper
  that matches the previous fuzz.token_sort_ratio shape. All 23 string-diff
  unit tests pass (including the 600-line comprehensive suite).

Dropped from requirements.testing.txt
- fastapi — declared but never imported anywhere in the repo.

Kept (still live, with non-trivial callers)
- httpx — 6 callsites for downloads and local-server probes.
- fasteners — InterProcessLock for installer concurrency in 2 places.
- clang-tool-chain — emscripten installer integration.
- zcmds_win32 — Windows-only git-bash bundle for debug symbol resolution.

Linters and the full unit-test suite are green after this change
(118 passed, 1 skipped).
@zackees
zackees force-pushed the chore/issue-59-remove-python-superseded-by-rust branch from 9a0608d to 80073c0 Compare May 12, 2026 23:47
@zackees
zackees merged commit 9db0077 into main May 13, 2026
25 checks passed
zackees added a commit that referenced this pull request May 13, 2026
Sweeps the non-Python items issue #59 flagged that are still on main
after PRs #61, #62, #64, #65, #66, #68 cleaned up the Python side:

* `entrypoint.sh` — Docker container entrypoint. Sourced
  `/emsdk/emsdk_env.sh` (container path) and called
  `fastled_wasm_compiler.cli_update_from_master` (a module from a
  separate package that only exists inside the container).
* `compiler/run.py` — Docker compile-server entry point. Imports
  `fastled_wasm_compiler`, a separate package not in this repo.
* `compiler/debug.sh` — instructed user to run from `/js` (container
  working directory). Empty `compiler/` directory removed.
* `.dockerignore` — only contained cache exclusions
  (`**/.mypy_cache/`, `**/.ruff_cache/`) which belong in `.gitignore`
  if anywhere; no Docker build context this could serve.
* `chrome_vscode_bridge_design_task.md` — one-off design draft that
  opens with "Here's a refined ... file for your repo. Feel free to
  adjust...". Zero references anywhere else.
* `upload_package.sh` — manual PyPI upload helper, superseded by the
  automated `publish_release.yml` workflow. Zero inbound references.
* Empty root-level `fastled/` directory left over from a prior layout.

`lint` script updated to stop passing the (now-deleted) `compiler/` path
to ruff / black / isort / pyright / the keyboard-interrupt checker.

`bash lint` clean. `bash test` — 119 pass.

Verified by grep across `*.py`, `*.rs`, `*.toml`, `*.yml`, `*.sh`,
`*.md`, `Cargo.toml` (excluding `.venv/` and `.claude/worktrees/`):
none of the deleted files are referenced from a live code path or
workflow.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant